//
//  LMJDropdownMenu.h
//
//  Created by Jerry LMJ on 15/5/4.
//  Copyright (c) 2015年 LMJ. All rights reserved.
//

#import <UIKit/UIKit.h>

@class LMJDropdownMenu;
@class CampusParamItemModel;
NS_ASSUME_NONNULL_BEGIN
@protocol LMJDropdownMenuDataSource <NSObject>
@required
- (NSUInteger)numberOfOptionsInDropdownMenu:(LMJDropdownMenu *)menu;
- (CGFloat)dropdownMenu:(LMJDropdownMenu *)menu heightForOptionAtIndex:(NSUInteger)index;
- (NSString *)dropdownMenu:(LMJDropdownMenu *)menu titleForOptionAtIndex:(NSUInteger)index;
- (CampusParamItemModel *)dropdownMenu:(LMJDropdownMenu *)menu itemModelForOptionAtIndex:(NSUInteger)index;
- (NSArray *)dropdownMenuListSource;

@optional
- (UIImage *)dropdownMenu:(LMJDropdownMenu *)menu iconForOptionAtIndex:(NSUInteger)index;
@end


@protocol LMJDropdownMenuDelegate <NSObject>
@optional
- (void)dropdownMenuWillShow:(LMJDropdownMenu *)menu;    // 当下拉菜单将要显示时调用
- (void)dropdownMenuDidShow:(LMJDropdownMenu *)menu;     // 当下拉菜单已经显示时调用
- (void)dropdownMenuWillHidden:(LMJDropdownMenu *)menu;  // 当下拉菜单将要收起时调用
- (void)dropdownMenuDidHidden:(LMJDropdownMenu *)menu;   // 当下拉菜单已经收起时调用

- (void)dropdownMenu:(LMJDropdownMenu *)menu didSelectOptionAtIndex:(NSUInteger)index itemModel:(CampusParamItemModel *)itemModel; // 当选择某个选项时调用
@end




@interface LMJDropdownMenu : UIView <UITableViewDataSource,UITableViewDelegate>

@property (nonatomic, weak) id <LMJDropdownMenuDataSource> dataSource;
@property (nonatomic, weak) id <LMJDropdownMenuDelegate> delegate;


@property (nonatomic,assign) CGFloat animateTime;   // 下拉动画时间 default: 0.25


@property (nonatomic,assign)CGFloat optionsListLimitHeight;

@property (nonatomic,assign)CGPoint anchorPoint;

- (void)reloadOptionsData;

- (void)showDropDownInView:(UIView *)mainView; // 显示下拉菜单

- (void)hideDropDown; // 隐藏下拉菜单

- (void)dismissMenu;

@end

NS_ASSUME_NONNULL_END
